<template>
<dic></dic>
</template>

<script>
export default {
name: "index"
}
</script>

<script>
import {getInfo} from "@/api/login";

export default {
  name: "LoginSso",
  data() {
    return {
      loginRules: {},
      loading: false,//验证码开关captchaOnOff: true,//注册开关register: false,//重定向redirect: undefined};},watch: {},created() {//页面初始化时调单点登录方法this.loginSso();},methods: {loginSso(){//获取地址栏中的codeconst code = this.$route.query.code;console.log("code="+code)//调用登录的接口if(code==''||code==undefined||code==null){//请求中不带code，拦截为正常登录}else{this.loading = true;//开启过渡动画const loginInfo = {"code" : code};//执行另一套登录操作//不是本系统的用户,去J平台登陆去this.$store.dispatch("LoginSso", loginInfo).then(() => {this.$message.success("登录成功");this.loading = false;//判断当前角色getInfo().then((res) => {//获取角色名称var rolesName = res.roles[0];//获取所属场馆this.deptInfo = res.dept;sessionStorage.setItem("ssUserName", res.user.nickName);//处理登录this.$router.push({path: this.redirect || "/"}).catch(() => {});});}).catch(err=> {console.log("有异常信息",err);this.loading = false;});}},}
  }
  }
  };
</script><style rel="stylesheet/scss" lang="scss"></style>
